<?php
/**
 * //w/w/w.s/h/u/o/t//u/p/u c/o/m  说/图/谱/源/码/分/享
 */
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/19 0019
 * Time: 15:26
 */
defined("IN_IA") or exit("Access Denied");
checklogin();  //验证是否登录
global $_W,$_GPC;
$uniacid=$_W['uniacid'];
$op=$_GPC['op'] ? $_GPC['op'] : "index";
if($op=='index'){

    $con=array(
        'uniacid'=>$uniacid,
        'ref_date'=>date("Ymd",strtotime('-1 days')),
    );
    $global=pdo_get('wxapp_general_analysis',$con);
    //用户总数
    $user_total = pdo_fetchcolumn("SELECT COUNT(*) FROM ".tablename('cqkundian_farm_user')." WHERE uniacid=".$uniacid);

    //商品总数
    $shop_goods_count=pdo_fetchcolumn("SELECT COUNT(*) FROM ".tablename('cqkundian_farm_goods')." WHERE uniacid=".$uniacid);
    $group_goods_count=pdo_fetchcolumn("SELECT COUNT(*) FROM ".tablename('cqkundian_farm_group_goods')." WHERE uniacid=".$uniacid);
    $integral_goods_count=pdo_fetchcolumn("SELECT COUNT(*) FROM ".tablename('cqkundian_farm_integral_goods')." WHERE uniacid=".$uniacid);
    $all_goods=$shop_goods_count+$group_goods_count+$integral_goods_count;

    //土地租赁次数
    $land_count=pdo_fetchcolumn('SELECT COUNT(*) FROM '.tablename('cqkundian_farm_land_mine')." WHERE uniacid=".$uniacid);
    //认养次数
    $animal_count=pdo_fetchcolumn('SELECT COUNT(*) FROM '.tablename('cqkundian_farm_animal_adopt')." WHERE uniacid=".$uniacid);

    //商城订单总数
    $shop_order_count=pdo_fetchcolumn('SELECT COUNT(*) FROM '.tablename('cqkundian_farm_shop_order')." WHERE uniacid=".$uniacid);
    $group_order_count=pdo_fetchcolumn('SELECT COUNT(*) FROM '.tablename('cqkundian_farm_group_order')." WHERE uniacid=".$uniacid);
    $land_order_count=pdo_fetchcolumn('SELECT COUNT(*) FROM '.tablename('cqkundian_farm_shop_order')." WHERE uniacid=".$uniacid." AND order_type=4");
    $animal_order_count=pdo_fetchcolumn('SELECT COUNT(*) FROM '.tablename('cqkundian_farm_shop_order')." WHERE uniacid=".$uniacid." AND order_type=3");

    include $this->template('web/common/home');
}


//小程序页面自定义
if($op=='homePage'){



    include $this->template("web/home/index");
}


